﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Autocentro.Entities;

namespace Autocentro.Respository.Mapping
{
    public class ProveedorMap:EntityTypeConfiguration<PROVEEDOR>
    {
        public ProveedorMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            this.Property(c => c.Ruc)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(c => c.RazonSocial)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(c => c.Telefono)
                .IsOptional()
                .HasMaxLength(21);

            this.Property(c => c.Direccion)
                .IsOptional()
                .HasMaxLength(200);

            this.ToTable("PROVEEDOR");
            this.Property(c => c.Id).HasColumnName("Id");
            this.Property(c => c.Ruc).HasColumnName("Ruc");
            this.Property(c => c.RazonSocial).HasColumnName("RazonSocialNombre");
            this.Property(c => c.Telefono).HasColumnName("Telefono");
            this.Property(c => c.Direccion).HasColumnName("Direccion");
        }
    }
}
